   <?php
   //userQueries::userLevel("1");
      $auth = Auth::getAuth('current_user');
      $userCompany = new userQueries();
   ?>

<div class="content_wrapper">
   <div class="padding_5">
      <div class="widget" style="height: 510px;background-color: #fff;">
         <?php
            $db = new Database();
            $user = explode("/",$_SERVER["REQUEST_URI"]);
            $search_user = explode("_",$user[1]);
            $lname = str_replace("%20"," ",$search_user[0]);
            $fname = str_replace("%20"," ",$search_user[1]);
            $u = $db->query("SELECT * FROM tbuser WHERE last_name={$db->escape($lname)} AND first_name={$db->escape($fname)} AND is_active={$db->escape(1)}","row");
            $personDoc = new Person($db,$u['id']);
         ?>
         <div class="head">
            <div class="title_head">
               <?php
                  echo $personDoc->first_name . " " . $personDoc->last_name . "'s profile";
               ?>
            </div>
         </div>
         <div class=" contentHolder userLocation_coord" data-location="<?php echo $personDoc->id; ?>">
            <div class="pull-left padding_5" style="width:65%;">
               <?php
               if($personDoc->display_name!=""){
               ?>
                  <div class="fields">
                     <div class="label">Display name:</div>
                     <div class="input_position">
                        <label class="label_value"><?php echo $personDoc->display_name; ?></label>
                     </div>
                  </div>
               <?php
               }
               if($personDoc->contact_number!=""){
               ?>
                  <div class="fields">
                     <div class="label">Contact Number:</div>
                     <div class="input_position">
                        <label class="label_value"><?php echo $personDoc->contact_number; ?></label>
                     </div>
                  </div>
               <?php
               }
               if($personDoc->department->name!=""){
               ?>
                  <div class="fields">
                     <div class="label">Department:</div>
                     <div class="input_position">
                        <label class="label_value"><?php echo $personDoc->department->name; ?></label>
                     </div>
                  </div>
               <?php
               }
               if($personDoc->position!=""){
               ?>
                  <div class="fields">
                     <div class="label">Position:</div>
                     <div class="input_position">
                        <label class="label_value"><?php echo $personDoc->position; ?></label>
                     </div>
                  </div>
               <?php
               }
               if($personDoc->company->name!=""){
               ?>
                  <div class="fields">
                     <div class="label">Company:</div>
                     <div class="input_position">
                        <label class="label_value"><?php echo $personDoc->company->name; ?></label>
                     </div>
                  </div>
               <?php
               }
               if($personDoc->date_registered!=""){
               ?>
                  <div class="fields">
                     <div class="label">Date Registered:</div>
                     <div class="input_position">
                        <label class="label_value"><?php echo $personDoc->date_registered; ?></label>
                     </div>
                  </div>
               <?php
               }
               ?>
            </div>
            <div class="pull-right length3">
               <div style="margin-left: 30px;margin-top: 30px;">
               <!-- User Photo -->
                  <?php echo $userCompany->avatarPic("companyUser",$personDoc->id,"245","234","large","avatar userPhoto personalPhoto"); ?>
               </div>
            </div>
         </div>
       </div>  
   </div>
   <div class="content_wrapper">
      <div class="padding_5">
         <div class="head">
            <div class="title_head">
               <i class="icon-location-arrow"></i> User Last Login Location
            </div>
            <div class="">
               
            </div>
            
         </div>
         <iframe id="google_map" width="1015" height="350" src="https://maps.google.co.uk?output=embed" scrollbar="no"></iframe>
      </div>
   </div>
</div>
<script>
   $(document).ready(function(){
      var id = $(".userLocation_coord").attr("data-location");

      var c = function(pos){
              $.ajax({
                  type:"POST",
                  url:"/ajax/settings",
                  data:{action:"getLocation",id:id},
                  success:function(e){
                     if (e!="") {
                        document.getElementById('google_map').setAttribute('src', 'https://maps.google.co.uk/?q='+e+'&z=60&output=embed');
                     }else{
                        $("#google_map").hide();
                        $("#google_map").prev().hide();
                     }
                  }
               });
          }
      
      navigator.geolocation.getCurrentPosition(c, e, {
                  enableHighAccuracy: true
                  //timeout: 1
              })
   });
   
</script>
